<!--模板对应控制器：mysoft_back\public\js\myservice\tenant\ctrl-authorize.js-->
<style>

    .ico-more {
        position: relative;
    }

    .ico-more:hover .top-userinfo-menu {
        display: block;
    }

    .ico-more .top-userinfo-menu {
        top: 8px;
        left: -57px;
    }

    .ico-more .top-userinfo-menu-list {
        z-index: 1;
        left: 30px;
        width: 105px;
        top: 10px;
    }

    .ico-more .top-userinfo-menu-list i {
        margin: -7px 8px 0 -3px;
    }

    .ico-more .top-userinfo-menu-list a:hover, .add-org .top-userinfo-menu-list a:hover {
        color: #ffa10f;
        background-color: #fff;
    }

    .top-userinfo-menu-arrow {
        display: block;
        position: absolute;
        top: 0;
        z-index: 2;
        width: 10px;
        height: 7px;
        margin-left: -5px;
    }

    .a-dropdown {
        font-size: 10px;
        line-height: 12px;
        height: 12px;
        display: block;
        text-align: left;
    }

    form .checkbox label, .checkbox span {
        width: 160px;
        display: inline-block;
        font-size: 12px;
        padding-left: 18px;
        position: relative;
        line-height: 16px;
        transition: border 0.2s linear 0s;
        white-space: nowrap;
        cursor: pointer;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    form .checkbox-array .checkbox {
        margin-right: 10px !important;
        display: inline-block;
        width: 160px;
    }

    form .checkbox-array {
        margin: 30px 0 10px 0;
        padding: 10px 10px 0;
        max-height: 320px;
        overflow-y: auto;
        border: 1px solid #ddd;
    }

    form .checkbox-array > .checkbox:first-child {
        margin-top: -34px !important;
        position: absolute !important;
    }

    #tenant-authorize-select .checkbox label, .checkbox span {
        width: 70px;
    }

    #tenant-authorize-select .checkbox {
        display: inline-block;
    }

    .nav-filter-list.tab {
        display: inline-block;
        margin-left: 30px;
    }
    .nav-filter-list.tab li {
        float: left;
        height: 30px;
        line-height: 30px;
        padding: 0 15px;
        border: 1px solid #ddd;
        cursor: pointer;
    }
    .nav-filter-list.tab li:first-child {
        -webkit-border-top-left-radius: 4px;
        border-top-left-radius: 4px;
        -webkit-border-bottom-left-radius: 4px;
        border-bottom-left-radius: 4px;
        border-right: none;
    }
    .nav-filter-list.tab li:last-child {
        -webkit-border-top-right-radius: 4px;
        border-top-right-radius: 4px;
        -webkit-border-bottom-right-radius: 4px;
        border-bottom-right-radius: 4px;
    }
    .nav-filter-list.tab li:hover {
        background: #f8f8f8;
    }
    .nav-filter-list.tab li.selected {
        color: #fff;
        background: #f65c2d;
    }

    .mb10 {
        margin-bottom: 10px;
    }

    .h40 {
        height: 40px;
    }

    .nav-filter-combobox {
        width: 180px;
        position: absolute;
    }

    .mr200 {
        margin-right: 200px;
    }

    .fw900 {
        font-weight: 900;
    }

</style>

<div class="table-header table-header-border clearfix">
    <span class="fl lh30 f14">项目授权</span>
    <ul class="broker-list nav-filter-list tab">
        <li ng-class="{selected:tabType===item.field}"
            ng-repeat="item in tabTypes.selectItems" ng-bind="item.name"
            ng-click="changeCondition(tabTypes.field, item.field, true)">
        </li>
    </ul>
</div>

<!--选择列表-->
<div id="tenant-authorize-select">
    <div class="checkbox-wrap lh30 mt10 clearfix nav-filter-box">
        <span class="broker-text ng-binding" ng-bind="areaIdConst.title"></span>
        <div class="broker-list nav-filter-list">
            <a ng-class="{selected:(areaId===undefined?areaIdConst.defaultValue:areaId)===item.field}"
               ng-repeat="item in areaIdConst.selectItems" ng-bind="item.name"
               ng-click="changeCondition(areaIdConst.field, item.field)">
            </a>
        </div>
    </div>
    <div class="checkbox-wrap lh30 mt10 clearfix nav-filter-box">
        <span class="broker-text ng-binding" ng-bind="disableConst.title"></span>
        <div class="broker-list nav-filter-list">
            <a ng-class="{selected:(disable===undefined?disableConst.defaultValue:disable)===item.field}"
               ng-repeat="item in disableConst.selectItems" ng-bind="item.name"
               ng-click="changeCondition(disableConst.field, item.field)">
            </a>
        </div>
    </div>
    <div class="checkbox-wrap lh30 clearfix nav-filter-box">
        <span class="broker-text ng-binding mt10" ng-bind="orgStateConst.title"></span>
        <div class="broker-list nav-filter-list">
            <div ui-checkbox-array
                 ng-model="orgStateList"
                 on-change="getAuthData"
                 list="htStatusList">
            </div>
        </div>
    </div>
    <div class="checkbox-wrap lh30 mt10 clearfix nav-filter-box" ng-show="showIsXq()">
        <span class="broker-text ng-binding" ng-bind="isXqConst.title"></span>
        <div class="broker-list nav-filter-list">
            <a ng-class="{selected:(isXq===undefined?isXqConst.defaultValue:isXq)===item.field}"
               ng-repeat="item in isXqConst.selectItems" ng-bind="item.name"
               ng-click="changeCondition(isXqConst.field, item.field)">
            </a>
        </div>
    </div>
    <div class="checkbox-wrap lh30 h40 mt10 clearfix nav-filter-box" ng-show="showContactUser">
        <span class="broker-text ng-binding">交付人员：</span>
        <div class="mb10">
            <div ui-combobox data="contactUsers" text-field="name" value-field="value"
                 class="nav-filter-combobox"
                 show-filter="true"
                 onchange="getAuthData"
                 ng-model="contactUserId"></div>
        </div>
    </div>
    <div class="checkbox-wrap lh30 h40 mt10 clearfix nav-filter-box">
        <span class="broker-text ng-binding">产品名称：</span>
        <div class="mb10">
            <div ui-combobox data="apps" text-field="name" value-field="value"
                 class="nav-filter-combobox"
                 show-filter="true"
                 onchange="getAuthData"
                 ng-model="appCode"></div>
        </div>
    </div>
</div>

<!--项目应用授权列表【头】-->
<div class="lh30 mt20 clearfix">
    <span class="fl lh30 f14">项目应用授权列表</span>
    <div class="fl pie-chart-diagram">
        <div class="pie-chart">
            <div class="overview">
                <table>
                    <tbody>
                    <tr>
                        <td>
                            <div class="item">
                                <div class="name">
                                    租户数
                                </div>
                                <div class="value">
                                    <span class="highlight">{{overview.total || 0}}</span><span>个</span>
                                </div>
                            </div>
                        </td>
                        <td>
                            <div class="item">
                                <div class="name">
                                    项目数
                                </div>
                                <div class="value">
                                    <span class="highlight">{{overview.projectCount || 0}}</span><span>个</span>
                                </div>
                            </div>
                        </td>
                        <td>
                            <div class="item">
                                <div class="name">
                                    付费授权数
                                </div>
                                <div class="value">
                                    <span class="highlight">{{overview.payAuthCount || 0}}</span><span>个</span>
                                </div>
                            </div>
                        </td>
                        <td>
                            <div class="item">
                                <div class="name">
                                    免费授权数
                                </div>
                                <div class="value">
                                    <span class="highlight">{{overview.freeAuthCount || 0}}</span><span>个</span>
                                </div>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="fr btn-group">

        <input class="input-text fl w400 ml3" type="text" placeholder="租户名称、企业号、合同号、项目" ng-model="keyword"
               ng-enter="search(1)"/>
        <a class="btn" href="javascript:;" ng-click="search(1)">搜索</a>
        <a class="btn btn-yellow" href="javascript:;" ng-click="syncAuthProject($event)">
            获取最新
        </a>
        <a class="btn btn-yellow" href="javascript:;" ng-if="userAuthList.indexOf('1012') !== -1"
           ng-click="downloadExcel($event)">
            导出excel
        </a>
    </div>
</div>

<!--项目应用授权列表【表格】-->
<div id="tenant-authorize-list" class="mt10 table-responsive tenant-authorize-list">
    <div ng-show="tabType==='project'">
        <table class="table">
            <thead>
            <tr>
                <th width="40" class="text-center">序号</th>
                <th width="140">项目名称</th>
                <th width="440">产品名称</th>
                <th width="140">交付人员</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <table class="table" ng-repeat="tenant in authData">
                <colgroup>
                    <col style="width: 40px">
                    <col style="width: 140px">
                    <col style="width: 440px">
                    <col style="width: 140px">
                    <col style="width: 100px">
                </colgroup>
                <thead>
                <tr>
                    <th colspan="4" class="bgf8">
                        <div class="clearfix">
                            <a class="fl ml10 fw900" style="color: #333;" ui-dialog="租户详情"
                               ui-dialog-init="showInfomation( $dialog, $dialogScope, tenant )"
                               ui-dialog-template="{{informationTemplate}}">
                                {{ tenant.FriendlyName }}
                            </a>
                            <span class="ml10">
                                (
                                <span>{{tenant.projectCount}}个项目</span>
                                <span ng-show="tenant.payAuthCount">、{{tenant.payAuthCount}}个付费授权</span>
                                <span ng-show="tenant.freeAuthCount">、{{tenant.freeAuthCount}}个免费授权</span>
                                )
                            </span>
                        </div>
                    </th>
                    <th colspan="1" class="bgf8">
                        <div class="clearfix">
                            <a class="tab-text" ui-dialog="批量设置交付信息"
                               ng-show="userAuthList.indexOf('1013') !== -1"
                               ui-dialog-before-show="showAuthorizeBatch( $dialog, $dialogScope, tenant )"
                               ui-dialog-template="{{authorizeBatchTemplate}}">
                                批量设置交付信息
                            </a>
                        </div>
                    </th>
                </tr>
                </thead>
                <tbody ng-repeat="(pIndex, project) in tenant.applicationsView">
                <tr>
                    <td width="40" class="text-center">
                        <p> {{ pIndex + 1 }} </p>
                    </td>
                    <td width="140">
                        <a class="vi-color" style="color: #333;" ui-dialog="项目详情"
                           ui-dialog-init="showProjInfo( $dialog, $dialogScope, project )"
                           ui-dialog-template="{{projInfoTemplate}}">
                            {{project.ProjName}}
                        </a>
                    </td>
                    <td width="440">
                        {{ project.productNames }}
                    </td>
                    <td width="140">
                        {{ project.contactUserNames }}
                    </td>
                    <td width="100">
                        <a class="vi-color tab-text" ng-init="updateAuthInfo = userAuthList.indexOf('1013') !== -1"
                           ui-dialog="更新交付信息" ui-dialog-data="{ data: tenant, index: $index }"
                           ui-dialog-init="showAuthorizeArea( $dialog, $dialogScope, tenant, project, $index, updateAuthInfo )"
                           ui-dialog-template="{{showDeliveryInfoTemplate}}">
                            交付信息
                        </a>
                        <a class="vi-color tab-text"
                           ng-if="hasPermission1014 && project.isSetRemind"
                           ui-dialog="续签汇报"
                           ui-dialog-init="showSetRemind(tenant, contract, $dialog, $dialogScope, project.ProjId)"
                           ui-dialog-template="{{setRemindTemplate}}">
                            续签汇报
                        </a>
                    </td>
                </tr>
                </tbody>
            </table>
        </table>
    </div>

    <div ng-show="tabType==='product'">
        <table class="table">
            <thead>
            <tr>
                <th width="40" class="text-center">序号</th>
                <th width="140">项目名称</th>
                <th width="70">产品名称</th>
                <th width="160"> 产品租期</th>
                <th width="60">状态</th>
                <th width="120">合同甲方</th>
                <th width="270">合同号</th>
                <th>操作</th>
            </tr>
            </thead>
            <table class="table" ng-repeat="tenant in authData">
                <colgroup>
                    <col style="width: 40px">
                    <col style="width: 140px">
                    <col style="width: 70px">
                    <col style="width: 160px">
                    <col style="width: 60px">
                    <col style="width: 120px">
                    <col style="width: 270px">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th colspan="7" class="bgf8">
                        <div class="clearfix">
                            <a class="fl ml10 fw900" style="color: #333;" ui-dialog="租户详情"
                               ui-dialog-init="showInfomation( $dialog, $dialogScope, tenant )"
                               ui-dialog-template="{{informationTemplate}}">
                                {{ tenant.FriendlyName }}
                            </a>
                            <span class="ml10">
                                (
                                <span>{{tenant.projectCount}}个项目</span>
                                <span ng-show="tenant.payAuthCount">、{{tenant.payAuthCount}}个付费授权</span>
                                <span ng-show="tenant.freeAuthCount">、{{tenant.freeAuthCount}}个免费授权</span>
                                )
                            </span>
                        </div>
                    </th>
                    <th colspan="1" class="bgf8">
                        <div class="clearfix">
                            <a class="tab-text" ui-dialog="批量设置交付信息"
                               ng-show="userAuthList.indexOf('1013') !== -1"
                               ui-dialog-before-show="showAuthorizeBatch( $dialog, $dialogScope, tenant )"
                               ui-dialog-template="{{authorizeBatchTemplate}}">
                                批量设置交付信息
                            </a>
                        </div>
                    </th>
                </tr>
                </thead>
                <tbody ng-repeat="(pIndex, project) in tenant.applicationsView">
                <tr ng-repeat="contract in project.contracts">
                    <td width="40" rowspan="{{project.contracts.length}}" class="text-center" ng-if="!$index">
                        <p> {{ pIndex + 1 }} </p>
                    </td>
                    <td width="80" rowspan="{{project.contracts.length}}" ng-if="!$index">
                        <a class="vi-color" style="color: #333;" ui-dialog="项目详情"
                           ui-dialog-init="showProjInfo( $dialog, $dialogScope, project )"
                           ui-dialog-template="{{projInfoTemplate}}">
                            {{project.ProjName}}
                        </a>
                        <p>
                            <a class="vi-color tab-text" ng-init="updateAuthInfo = hasPermission1013"
                               ui-dialog="更新交付信息"
                               ui-dialog-data="{ data: tenant, index: $index }"
                               ui-dialog-init="showAuthorizeArea( $dialog, $dialogScope, tenant, project, $index, updateAuthInfo )"
                               ui-dialog-template="{{showDeliveryInfoTemplate}}">
                                交付信息
                            </a>
                        </p>
                    </td>
                    <td width="70">
                        {{ contract.appName }}
                    </td>
                    <td width="160">
                        {{ contract.BeginOn.substring(0, 10) }}到{{ contract.EndOn.substring(0, 10) }}
                    </td>
                    <td width="60">
                        <p ng-if="contract.statusTpl"
                           ui-tip
                           template="{{contract.statusTpl}}"
                           class="{{contract.className}}">
                            {{contract.statusText}}
                        </p>
                        <p ng-if="!contract.statusTpl"
                           class="{{contract.className}}">
                            {{contract.statusText}}
                        </p>
                    </td>
                    <td width="160">
                        {{contract.PartyA}}
                    </td>
                    <td width="270" ng-if="contract.ContractManageId">
                        <a class="tab-text text-hide"
                           ng-href="{{'/contract/edit_view.html#/base?id='+contract.ContractManageId
                           }}" target="_blank">
                            {{contract.ContractNum}}
                        </a>
                    </td>
                    <td ng-if="!contract.ContractManageId">
                        <p class="text-hide">{{contract.ContractNum}}</p>
                    </td>
                    <td>
                        <a class="mr10 tab-text" ng-if="contract.hasReceivable" ui-dialog="回款信息"
                           ui-dialog-init="getReceivableInfoUrl($dialogScope, contract)"
                           ui-dialog-template="{{receivableInfoUrl}}">
                            回款信息
                        </a>
                        <a class="mr10 tab-text" ng-if="contract.isSetRemind =='0' && hasPermission1014"
                           ui-dialog="续签设置结果"
                           ui-dialog-init="showGetRemind(tenant, contract, project, $dialog, $dialogScope )"
                           ui-dialog-template="{{getRemindTemplate}}">
                            不续签
                        </a>
                        <a class="mr10 tab-text" ng-if="contract.isSetRemind == '1' && hasPermission1014"
                           ui-dialog="续签设置结果"
                           ui-dialog-init="showGetRemind(tenant, contract, project, $dialog, $dialogScope )"
                           ui-dialog-template="{{getRemindTemplate}}">
                            续签
                        </a>
                        <div class="mr10 ico-more"
                             ng-if="contract.isSetRemind == '-1' && !(contract.Status == '1' || contract.isOverdue == '1') && hasPermission1014"
                             style="display: inline-block;height: 30px;">
                            <a href="javascript:;" ui-tip use-parent-scope template={{remindTpl}}>
                                续签汇报
                            </a>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </table>
    </div>
    <div class="no-data" ng-hide="authData && authData.length"><span>暂无数据</span></div>
</div>

<div ui-pagination page-index="pageIndex" page-size="pageSize" total="pageTotal"
     changed="authListPageChange( $pageIndex, $pageSize )">
</div>
